.stats-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.stats-page h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 2rem;
}

.loading {
  text-align: center;
  padding: 50px;
  font-size: 1.2rem;
  color: #666;
}

/* 标签页导航 */
.stats-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 30px;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.tab-button:hover {
  color: #007bff;
  background-color: #f8f9fa;
}

.tab-button.active {
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: 600;
}

/* 统计概览 */
.stats-overview {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-5px);
}

.stats-card h3 {
  margin: 0 0 15px 0;
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 500;
}

.stats-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0;
}

/* 热门文件 */
.top-files {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.top-files h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.3rem;
}

.top-files-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.top-file-item {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

.rank {
  font-size: 1.2rem;
  font-weight: bold;
  color: #007bff;
  margin-right: 15px;
  min-width: 40px;
}

.file-info {
  flex: 1;
}

.filename {
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.download-count {
  color: #666;
  font-size: 0.9rem;
}

.last-download {
  color: #999;
  font-size: 0.85rem;
}

/* 文件统计表格 */
.files-stats {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.files-stats h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.3rem;
}

.files-table {
  overflow-x: auto;
}

.files-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.files-table th,
.files-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.files-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
}

.files-table tr:hover {
  background-color: #f8f9fa;
}

.files-table .filename {
  font-weight: 500;
  color: #007bff;
  max-width: 300px;
  word-break: break-all;
}

.files-table .download-count {
  font-weight: 600;
  color: #28a745;
}

/* 下载历史 */
.download-history {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.download-history h3 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.3rem;
}

/* 下载历史筛选 */
.history-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.history-filters {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

/* 便捷时间选项 */
.quick-date-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quick-date-filters-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.quick-date-filters label,
.quick-date-filters-inline label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #555;
}

.quick-date-filters-inline label {
  white-space: nowrap;
  margin-bottom: 0;
}

.quick-date-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.quick-date-btn {
  height: 38px;
  padding: 8px 12px;
  background-color: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.quick-date-btn:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
}

.quick-date-btn:active {
  background-color: #007bff;
  border-color: #007bff;
  color: white;
  transform: translateY(1px);
}

/* 日期选择器组合 */
.date-range-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex: 1;
  justify-content: flex-start;
}

.date-range-group .reset-filters-btn {
  margin-left: auto;
}

.date-range-group .filter-group input,
.date-range-group .filter-group-inline input {
  height: 38px;
  padding: 8px 12px;
  box-sizing: border-box;
}

.date-range-group .filter-group input[type="date"],
.date-range-group .filter-group-inline input[type="date"] {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.date-range-group .filter-group input[type="date"]::-webkit-calendar-picker-indicator,
.date-range-group .filter-group-inline input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

.date-range-group .filter-group input[type="date"],
.date-range-group .filter-group-inline input[type="date"] {
  text-align: left;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}

.filter-group-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.filter-group label,
.filter-group-inline label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #555;
}

.filter-group-inline label {
  white-space: nowrap;
  margin-bottom: 0;
}

.filter-group select,
.filter-group input,
.filter-group-inline select,
.filter-group-inline input {
  height: 38px;
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.875rem;
  background-color: white;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.filter-group select:focus,
.filter-group input:focus,
.filter-group-inline select:focus,
.filter-group-inline input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.reset-filters-btn {
  height: 38px;
  padding: 8px 12px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
  width: auto;
}

.reset-filters-btn:hover {
  background: #5a6268;
}

.filter-summary {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #666;
}

.active-filters {
  color: #007bff;
  font-weight: 500;
}

.history-table {
  overflow-x: auto;
}

.history-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.history-table th,
.history-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.history-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
}

.history-table tr:hover {
  background-color: #f8f9fa;
}

.history-table .filename {
  font-weight: 500;
  color: #007bff;
  max-width: 250px;
  word-break: break-all;
}

/* 地理信息样式 */
.location-info {
  min-width: 150px;
}

.location-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.location-main {
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.location-isp {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

.location-unknown {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

/* 浏览器信息样式 */
.browser-info {
  min-width: 180px;
}

.browser-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.browser-main {
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.browser-os {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

/* 爬虫和自动化工具样式 */
.bot-browser {
  color: #e74c3c !important;
  font-weight: 600 !important;
}

.bot-os {
  color: #e74c3c !important;
  font-weight: 500 !important;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 20px 0;
  gap: 15px;
}

.pagination-info {
  color: #666;
  font-size: 0.9rem;
  flex: 1;
}

.pagination-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-size-selector label {
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
}

.page-size-selector select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

.pagination-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
  white-space: nowrap;
  min-width: auto;
  width: auto;
}

.pagination-btn:hover:not(:disabled) {
  background: #0056b3;
}

.pagination-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .stats-page {
    padding: 15px;
  }
  
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .stats-card {
    padding: 15px;
  }
  
  .stats-number {
    font-size: 1.8rem;
  }
  
  .top-file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .rank {
    margin-right: 0;
  }
  
  .files-table,
  .history-table {
    font-size: 0.9rem;
  }
  
  .files-table th,
  .files-table td,
  .history-table th,
  .history-table td {
    padding: 8px;
  }
  
  .history-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 0.75rem;
  }
  
  .quick-date-filters-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .quick-date-buttons {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  
  .quick-date-btn {
    flex: 0 0 auto;
    min-width: 70px;
  }
  
  .date-range-group {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-group,
  .filter-group-inline {
    width: 100%;
    min-width: auto;
  }
  
  .filter-group-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  
  .filter-group select,
  .filter-group input,
  .filter-group-inline select,
  .filter-group-inline input {
    width: 100%;
  }
  
  .reset-filters-btn {
    align-self: stretch;
    margin-top: 0.5rem;
  }
  
  .file-type-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .pagination {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .pagination-info {
    text-align: center;
    order: 2;
  }
  
  .pagination-buttons {
    justify-content: center;
    order: 1;
  }
}

@media (max-width: 480px) {
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .history-header {
    gap: 0.75rem;
  }
  
  .history-filters {
    padding: 0.5rem;
    gap: 0.75rem;
  }
  
  .quick-date-buttons {
    gap: 0.25rem;
  }
  
  .quick-date-btn {
    font-size: 0.8rem;
    padding: 5px 10px;
    min-width: 60px;
  }
  
  .files-table,
  .history-table {
    font-size: 0.8rem;
  }
  
  .files-table th,
  .files-table td,
  .history-table th,
  .history-table td {
    padding: 6px;
  }
}

/* 文件类型筛选器组 */
.file-type-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem;
  background-color: #f1f3f4;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  margin-bottom: 1rem;
} 